<template>
  <el-table :data="lunbolist" style="width: 100%;">
    <el-table-column fixed prop="bannerid" label="商品ID" width="400" align="center" />
    <el-table-column prop="alt" label="名称" width="180" align="center" />
    <el-table-column prop="img" label="图片" width="240" align="center">
      <template #default="scope">
          <el-image style="width: 100px; height: 100px" :src="scope.row.img" :zoom-rate="1.2" :max-scale="7"
            :min-scale="0.2" show-progress :initial-index="4" fit="cover" :preview-src-list="scope.row.imgs"
            :preview-teleported="true" />
      </template>
    </el-table-column>
    <el-table-column fixed="right" label="操作" min-width="300" align="center">
      <template #default="scope">
        <el-button type="primary" @click="put()">
          编辑
        </el-button>
        <el-button type="danger" @click="delete1(scope.row.bannerid)">删除</el-button>
      </template>
    </el-table-column>
  </el-table>

   <!-- <el-dialog v-model="dialogFormVisible" title="修改部门管理" width="500px">
      <el-form :model="putlist">
        <el-form-item label="部门名称" label-width="100px">
          <el-input v-model="putlist.bannerid" autocomplete="off" placeholder="请输入部门名称" />
        </el-form-item>
        <el-form-item label="部门编号" label-width="100px">
          <el-input v-model="putlist.alt" autocomplete="off" placeholder="请输入部门编号" />
        </el-form-item>
        <el-form-item label="排序号" label-width="100px">
          <el-input v-model="putlist.sort" autocomplete="off" placeholder="请输入排序号" />
        </el-form-item>
        <el-form-item label="状态" label-width="100px">
          <el-input v-model="putlist.status" autocomplete="off" placeholder="请输入状态" />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="dialogFormVisible = false">取消</el-button>
          <el-button type="primary" @click="put()">
            确认
          </el-button>
        </div>
      </template>
    </el-dialog> -->
</template>
<script setup lang="ts">
import { LunboDeleterequest, Lunbolistrequest } from '@/api/lunbo';
import { ref } from 'vue';
const dialogFormVisible = ref(false)
const lunbolist = ref([]);
// const putlist = ref({});
async function list() {
  await Lunbolistrequest().then((res) => {
    lunbolist.value = res.data.data;
    console.log(lunbolist.value);
  });
}
list();
function put() {
dialogFormVisible.value = true;
}
async function delete1(bannerid: string) {
  await LunboDeleterequest(bannerid).then((res) => {
    console.log(res);
    list(); // 刷新列表
  })
}
</script>
<style lang="css" scoped></style>
